import React, {PureComponent} from 'react';
import {DateComp, InputComp, systemDateFormat} from 'jh-lib';
import {newDateIns} from 'jh-utils'
import {Button, Col, Form, Row, Tooltip} from "antd";
import dayjs from "dayjs";

export default class Test extends PureComponent {
    formRef = React.createRef();

    render() {
        return (
            <div>
                {/*<h3>前缀后缀</h3>*/}
                <Form component={false} ref={this.formRef}
                      validateMessages={{
                          required: "'${name}' 是必选字段",
                      }}
                      onValuesChange={(changedValues, allValues) => {
                          console.log('changedValues', changedValues)
                          console.log('allValues', allValues)
                      }}>
                    <div className={'demo-contain'}>
                        <h2>单日期</h2>
                        <Row gutter={[16, 16]}>
                            <Col span={24}>
                                <DateComp fieldName={'f1'} compLabel={'f1 默认使用'}/>
                            </Col>
                            <Col span={24}>
                                <DateComp defaultValue={new Date()} fieldName={'f2'} compLabel={'f2 defaultValue new Date()'}/>
                            </Col>
                            <Col span={24}>
                                <DateComp defaultValue={newDateIns()} fieldName={'f3'} compLabel={'f3 defaultValue newDateIns()'}/>
                            </Col>
                            <Col span={24}>
                                <DateComp compLabel={'value 1567608875'} value={1567608875}/>
                            </Col>
                        </Row>
                        <h2>日期区间</h2>
                        <Row gutter={[16, 16]}>
                            <Col span={24}>
                                <DateComp range={true} fieldName={'ff1'} compLabel={'ff1 默认使用'}/>
                            </Col>
                            <Col span={24}>
                                <DateComp range={true} defaultValue={[new Date()]} fieldName={'ff2'} compLabel={'ff2 defaultValue new Date()'}/>
                            </Col>
                            <Col span={24}>
                                <DateComp range={true} defaultValue={[newDateIns()]} fieldName={'ff3'} compLabel={'ff3 defaultValue newDateIns()'}/>
                            </Col>
                            <Col span={24}>
                                <DateComp style={{width: '100%'}} range={true} compLabel={'固定value'} value={[1567608875, 1567609999]}/>
                            </Col>
                            <Col span={24}>
                                <InputComp style={{width: '100%'}} compLabel={'固定value'} value={234}/>
                            </Col>
                        </Row>
                    </div>
                </Form>
            </div>
        )
    }
}